package emil.poker.players;

import emil.poker.Decision;
import emil.poker.LimitHoldem.Street;

public class BetCallFoldPlayer extends BetOrRaisePlayer {
	double probabilityRaises;
	double probabilityFolds;
	boolean currentlyRaising = true;
	boolean currentlyFolding = true;
	
	@Override
	public Decision makeDecision( Decision[] list ) {
		String legalDecisions = "";
		for (Decision decision : list) {
			legalDecisions+= decision.toString();
		}
		logger.info("Legal Decisions: " + legalDecisions);
		if (!Street.PREFLOP.equals(getGame().getStreet())) {
			return check();
		}
		displayInfo();
		double random = Math.random();
		if ( random * 100 <= probabilityFolds ) {
			return foldOrCheck(list);
		} else if ( random * 100 <= probabilityFolds + probabilityRaises ) {
			return raiseOrCall(list);
		} else {
			return callOrCheck(list);
		}
	}
	
	public BetCallFoldPlayer() {
		super();
	}
		
	public double getProbabilityRaises() {
		return probabilityRaises;
	}
	
	public void setProbabilityRaises(double probabilityRaises) {
		this.probabilityRaises = probabilityRaises;
	}
	
	public double getProbabilityFolds() {
		return probabilityFolds;
	}
	
	public void setProbabilityFolds(double probabilityFolds) {
		this.probabilityFolds = probabilityFolds;
	}
	
	public BetCallFoldPlayer(double probabilityFolds, double probabilityRaises) {
		super( "Player folds "+probabilityFolds+
		"%, raises " +probabilityRaises+
		"%, calls "+(100-probabilityRaises-probabilityFolds)+"%" );
		this.probabilityRaises = probabilityRaises;
		this.probabilityFolds = probabilityFolds;
	}
}
